monit mysql

您所在的位置:网站首页 php redis mysql monit mysql

monit mysql

#monit mysql| 来源: 网络整理| 查看: 265

大家好,我是你的好朋友思创斯。今天说一说monit mysql_monit配置监控启动nginx php mysql redis mongodb 服务器,希望您对编程的造诣更进一步.

—————nginx php mysql redis mongodb 配置 完美OK——————–

# nginx

check process nginx withpidfile /usr/local/nginx/logs/nginx.pid

start program = “/usr/local/nginx/sbin/nginx”

stop program = “/usr/bin/killall nginx”

iffailed host 127.0.0.1 port 80 then restart

ifcpu is greater than 40%for2 cycles then alert

ifcpu > 60%for5 cycles then restart

if10 restarts within 10 cycles then timeout

# php5-fpm

check process php-fpm withpidfile /var/run/php-fpm.pid

start program = “/usr/local/php5.3/sbin/php-fpm”

stop program = “/usr/bin/killall php-fpm”

iffailed port 9000 then restart

ifcpu is greater than 40%for2 cycles then alert

ifcpu > 60%for5 cycles then restart

if10 restarts within 10 cycles then timeout# php5-fpm binary.

check file php5-fpm-tcp_bin withpath /usr/local/php5.3/sbin/php-fpm

if10 restarts within 10 cycles then timeout

iffailed checksum then unmonitor

iffailed permission 755 then unmonitor

iffailed uid root then unmonitor

iffailed gid root then unmonitor

alert root@localhost# Test the init scripts.

check file php5-fpm-tcp_init withpath /usr/local/php5.3/sbin/php-fpm

iffailed checksum then unmonitor

iffailed permission 755 then unmonitor

iffailed uid root then unmonitor

iffailed gid root then unmonitor

alert root@localhost

# mysql

check process mysql withpidfile /var/lib/mysql/localhost.localdomain.pid

group database

start program = “/sbin/service mysql start”

stop program = “/sbin/service mysql stop”

iffailed port 8306 then restart

if3 restarts within 10 cycles then timeout

# redis

check process redis withpidfile /var/run/redis.pid

start program = “/usr/local/redis/redis-server /usr/local/redis/redis.conf”

stop program = “/usr/bin/killall redis-server”

iffailed host 127.0.0.1 port 6379 then restart

ifcpu is greater than 40%for2 cycles then alert

ifcpu > 60%for5 cycles then restart

if10 restarts within 10 cycles then timeout

# mongodb

check process mongod withpidfile /usr/local/mongodb/data/mongod.lock

start program = “/usr/local/mongodb/bin/mongod –dbpath=/usr/local/mongodb/data/”

stop program = “/usr/bin/killall mongod”

iffailed port 27017 protocol http and request “/”withtimeout 10 seconds then restart

if10 restarts within 10 cycles then timeout

—————-end——————-

/usr/local/mmonit/bin/mmonit -c /usr/local/mmonit/conf/server.xml -t

/usr/local/mmonit/bin/mmonit -c /usr/local/mmonit/conf/server.xml start

monit  -t

killall monit

monit -Ic /etc/monitrc &

telinit q

ps aux |grep monit

kill -1 1

ps aux |grep redis-server

killall redis-server

ll /var/run/redis.pid

/usr/local/redis/redis-server /usr/local/redis/redis.conf &

ps aux |grep php-fpm

killall php-fpm

/usr/local/php5.3/sbin/php-fpm

ps aux |grep mongod

killall mongod

/usr/local/mongodb/bin/mongod –dbpath=/usr/local/mongodb/data/ &

set mmonit http://monit:[email protected]:8080/collector

set nginx port 80 and

use address 142.4.48.50

allow localhost

allow 142.4.48.50

http://mmonit.com/wiki/Monit/Nginx

location /monit/ {

rewrite ^/monit/(.*) /$1 break;

proxy_ignore_client_abort on;

proxy_pass   http://192.168.1.10:2812;

proxy_redirect  http://192.168.1.10:2812/monit;

}

https://gist.github    .com/franck

# include /etc/monit.d/*

# mysql

check process mysqld withpidfile /var/lib/mysql/localhost.localdomain.pid

group database

start program = “/etc/init.d/mysql start”

stop program = “/etc/init.d/mysql stop”

iffailed host 127.0.0.1 port 8306 then restart

if5 restarts within 5 cycles then timeout

# nginx

check process nginx withpidfile /usr/local/nginx/logs/nginx.pid

start program = “/usr/local/nginx/sbin/nginx”

stop program = “/usr/bin/killall nginx”

iffailed host 127.0.0.1 port 80 then restart

ifcpu is greater than 40%for2 cycles then alert

ifcpu > 60%for5 cycles then restart

if10 restarts within 10 cycles then timeout

# redis

check process redis withpidfile /var/run/redis.pid

start program = “/usr/local/redis/redis-server /usr/local/redis/redis.conf”

stop program = “/usr/bin/killall redis-server”

if10 restarts within 10 cycles then timeout

check file dump.rdb withpath /usr/local/redis/dump.rdb

ifsize > 100 MB then alert

# php5-fpm

check process php-fpm withpidfile /var/run/php-fpm.pid

start program = “/usr/local/php5.3/sbin/php-fpm”

stop program = “/usr/bin/killall php-fpm”

iffailed host 127.0.0.1 port 9000 then restart

ifcpu is greater than 40%for2 cycles then alert

ifcpu > 60%for5 cycles then restart

if10 restarts within 10 cycles then timeout

# php5-fpm binary.

check file php5-fpm-tcp_bin withpath /usr/local/php5.3/sbin/php-fpm

if10 restarts within 10 cycles then timeout

iffailed checksum then unmonitor

iffailed permission 755 then unmonitor

iffailed uid root then unmonitor

iffailed gid root then unmonitor

alert root@localhost

# Test the init scripts.

check file php5-fpm-tcp_init withpath /usr/local/php5.3/sbin/php-fpm

iffailed checksum then unmonitor

iffailed permission 755 then unmonitor

iffailed uid root then unmonitor

iffailed gid root then unmonitor

alert root@localhost

# mysql

check process mysqld withpidfile /var/lib/mysql/localhost.localdomain.pid

group database

start program = “/sbin/service mysql start”

stop program = “/sbin/service mysql stop”

iffailed host 127.0.0.1 port 8306 then restart

if2 restarts within 6 cycles then timeout

# mongodb

check process mongod withpidfile /usr/local/mongodb/data/mongod.lock

start program = “/usr/local/mongodb/bin/mongod –dbpath=/usr/local/mongodb/data/”

stop program = “/usr/bin/killall mongod”

iffailed port 27017 protocol http and request “/”withtimeout 10 seconds then restart

if10 restarts within 10 cycles then timeout

#mongodb

check process mongod withpidfile “/usr/local/mongodb/data/mongod.lock”

start program = “/usr/local/mongodb/bin/mongod –dbpath=/usr/local/mongodb/data/”

stop program = “/usr/bin/killall  mongod”

iffailed port 27017 protocol http and request “/”withtimeout 10 seconds then restart

if5 restarts within 5 cycles then timeout

# tomcat

check process tomcat withpidfile /var/run/tomcat/tomcat.pid

start program = “/etc/init.d/tomcat start”

as uid solr gid solr

stop program = “/etc/init.d/tomcat stop”

as uid solr gid solr  //phpfensi.com

iffailed port 8080 then alert

iffailed port 8080for5 cycles then restart

set mmonit http://monit:[email protected]:8080/collector

set httpd port 12112 and

use address 142.4.48.50 //monit主机的IP

allow localhost

allow 142.4.48.50 //mmonit主机的IP

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由思创斯整理,转载请注明出处:https://ispacesoft.com/107852.html



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3